//
//  YQMYBaseNavigationController.m
//  MuYing
//
//  Created by tbb on 2019/7/18.
//  Copyright © 2019 TBB. All rights reserved.
// 1

#import "YQMYBaseNavigationController.h"
static NSArray *hiddenNavBarClassArray = nil;
@interface YQMYBaseNavigationController ()<UINavigationControllerDelegate>
@end

@implementation YQMYBaseNavigationController
+(void)initialize {
    hiddenNavBarClassArray = [[NSArray alloc] initWithObjects:
                              NSClassFromString(@"MYLoginVC"),
                              NSClassFromString(@"MYPublishVC"),
                              NSClassFromString(@"MYPublishImageTagVC"),
                              NSClassFromString(@"MYPublishEditVC"),
                              nil];
    UINavigationBar *bar = [UINavigationBar appearance];
    bar.translucent = NO;

}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    self.view.backgroundColor = [UIColor whiteColor];
    
}


- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    Class vcClass = [viewController class];
    
    if ([hiddenNavBarClassArray containsObject:vcClass]) {
        [navigationController setNavigationBarHidden:YES animated:YES];
    }
    else
    {
        [navigationController setNavigationBarHidden:NO animated:YES];
    }
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    viewController.hidesBottomBarWhenPushed = YES;
    [super pushViewController:viewController animated:animated];
    if ([viewController isEqual:self.childViewControllers.firstObject]){
        viewController.hidesBottomBarWhenPushed = NO;
    }
}

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleDefault;
}


@end
